<?php
require_once 'models/models_user.php';
$obuser = new models_user();
if (!isset($_SESSION['login'])){
	$data['listuser'] = $obuser->_listuser();
	require 'views/admin/login/index.php';
	if(isset($_POST['username']))
	{
		foreach ($data['listuser'] as $item){
			if($_POST['password'] == $item['MatKhau'] && $_POST['username'] == $item['TenUser']) {
			//echo 'da tao session';
			echo '<script>window.location.href="admin.php?mod=loaihang"</script>';
			} else {
				$err = 'Nhap sai username va password';
			}
		}
	
	}
}
?>